﻿@{ Layout = "~/Views/Shared/_Index.cshtml"; }

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="gridTable" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function () {
        initGrid();
        //console.log($("#gridTable").children("tbody").children("tr"))

      
    });

    $(document).ready(function () {
        $("#gridTable").children("tbody").on("click", "tr", function (k, v) {
            //console.log(k.currentTarget.dataset.uniqueid);
            var test = $(this).children("td").eq(1).html();
            parent.callbackfun(k.currentTarget.dataset.uniqueid, test);
            ys.closeDialog();
        })
           
        
    });


   

    function initGrid() {
        var queryUrl = '@Url.Content("~/treatment/GetPageListJsonNoAuthority")';
        $('#gridTable').ysTable({
            url: queryUrl,
            sortName: 'BaseModifyTime',
            sortOrder: 'Asc',
            showRefresh: false,
            showColumns: false,
            showToggle: false,
          
            columns: [
                //{ checkbox: true, visible: true },
                { field: 'Id', title: 'Id', visible: false },
                { field: 'Title', title: '名称', width: "20%", sortable: true },
                { field: 'Content', title: '内容', width: "60%", sortable: false },

                {
                    field: 'BaseModifyTime', title: '创建时间', sortable: true, formatter: function (value, row, index) {
                        return ys.formatDate(value, "yyyy-MM-dd HH:mm:ss");
                    }
                }
            ],
            
            //queryParams: function (params) {
            //    var pagination = $('#gridTable').ysTable('getPagination', params);
            //    var queryString = $("#searchDiv").getWebControls(pagination);
            //    return queryString;
            //}
        });
    }

    function searchGrid() {
        $('#gridTable').ysTable('search');
        resetToolbarStatus();
    }


</script>